const ACCESS_TOKEN = 'access_token_key';
const USER_INFO = 'user_info_key';
const DEV_ID = 'dev_id_key';
const BASE64 = 'base_64_key';
const storage = {
  // 令牌
  token: {
    get() {
      // return '0e3aff1c-b1e6-4ffe-a292-861bffdda0c5';
      return uni.getStorageSync(ACCESS_TOKEN);
    },
    set(value) {
      uni.setStorageSync(ACCESS_TOKEN, value);
    },
    remove() {
      uni.removeStorageSync(ACCESS_TOKEN);
    },
  },
  userInfo: {
    get() {
      return uni.getStorageSync(USER_INFO);
    },
    set(value) {
      uni.setStorageSync(USER_INFO, value);
    },
    remove() {
      uni.removeStorageSync(USER_INFO);
    },
  },
  devId: {
    get() {
      return uni.getStorageSync(DEV_ID);
    },
    set(value) {
      uni.setStorageSync(DEV_ID, value);
    },
    remove() {
      uni.removeStorageSync(DEV_ID);
    },
  },
  base64: {
    get() {
      return uni.getStorageSync(BASE64);
    },
    set(value) {
      uni.setStorageSync(BASE64, value);
    },
    remove() {
      uni.removeStorageSync(BASE64);
    },
  },
  clearLoginStorage() {
    storage.token.remove();
    storage.userInfo.remove();
    console.log('removeStorage');
    console.log(storage.token.get());
  },
};

export default storage;